<?php

namespace App\Http\Controllers\Api\Plane;

use App\Http\Controllers\Controller;
use App\Trip\Enums\Plane\PlaneProviders;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;

class FlightCallbackController extends Controller
{
    /**
     * @throws Exception
     */
    public function callback($source, $business, Request $request)
    {
        Log::info("FlightCallback:{$source}:{$business}:".json_encode($request->all(), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
        $service = PlaneProviders::from($source)->getPlaneOrderStrategy();
        return $service->notify($business, $request->all());
    }
}
